package cn.calm.commons.dao.impl;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;

import cn.calm.commons.dao.IBaseDao;

public class Activator implements BundleActivator {
	public static BundleContext context;
	private ServiceRegistration<IBaseDao> serviceReg;
	
	@Override
	public void start(BundleContext arg0) throws Exception {
		context = arg0;
		IBaseDao dao=new BaseDaoImpl();
		serviceReg=arg0.registerService(IBaseDao.class, dao, null);
	}

	@Override
	public void stop(BundleContext arg0) throws Exception {
		if(serviceReg!=null){
			serviceReg.unregister();
		}
		context=null;
	}

}
